<?php $myCartObj = new Cart(); $myCartInfo = $myCartObj->getMyCart();$siteConfig=new Config("site_config");?>
<?php $siteConfigObj = new Config("site_config");$site_config   = $siteConfigObj->getInfo();?>
<?php $iurl = IUrl::creatUrl();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $siteConfig->name;?></title>
<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/index.css";?>" />
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/common.js";?>"></script>
<script charset="UTF-8" src="/runtime/systemjs/jquery-1.4.4.min.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/form.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/artdialog/artDialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="/runtime/systemjs/autovalidate/style.css"/><script charset="UTF-8" src="/runtime/systemjs/autovalidate/validate.js"></script>
</head>
<body class="index">
<div class="ucenter container">
	<div class="header">
		<h1 class="logo"><a title="<?php echo $siteConfig->name;?>" style="background:url(<?php echo IUrl::creatUrl("")."image/logo.gif";?>);" href="<?php echo IUrl::creatUrl("");?>"><?php echo $siteConfig->name;?></a></h1>
		<ul class="shortcut">
			<li class="first"><a href="<?php echo IUrl::creatUrl("/ucenter/index");?>">我的账户</a></li><li><a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a></li><li class='last'><a href="<?php echo IUrl::creatUrl("/site/help_list");?>">使用帮助</a></li>
		</ul>
		<?php $user = $this->user;?>
		<p class="loginfo"><?php echo isset($user['username'])?$user['username']:"";?>您好，欢迎您来到<?php echo $siteConfig->name;?>购物！[<a class='reg' href="<?php echo IUrl::creatUrl("/simple/logout");?>">安全退出</a>]</p>
	</div>
	<div class="navbar">
		<ul>
			<li><a href="<?php echo IUrl::creatUrl("");?>">首页</a></li>
			<?php $query = new IQuery("guide");$items = $query->find(); foreach($items as $key => $item){?>
			<li><a href="<?php echo isset($item['link'])?$item['link']:"";?>"><?php echo isset($item['name'])?$item['name']:"";?><span> </span></a></li>
			<?php }?>
		</ul>
		<div class="mycart">
			<dl>
				<dt><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">购物车<b name="mycart_count"><?php echo isset($myCartInfo['count'])?$myCartInfo['count']:"";?></b>件</a></dt>
				<dd><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">去结算</a></dd>
			</dl>

			<!--购物车浮动div 开始-->
			<div class="shopping" id='div_mycart' style='display:none;'>
			</div>
			<!--购物车浮动div 结束-->

		</div>
	</div>

	<div class="searchbar">
		<div class="allsort">
			<a href="javascript:void();">全部商品分类</a>

			<!--总的商品分类-开始-->
			<ul class="sortlist" id='div_allsort' style='display:none'>
				<?php $catResult = block::goods_category();?>
				<?php foreach($catResult as $key => $first){?>
					<li>
						<h2><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$first[id]");?>"><?php echo isset($first['name'])?$first['name']:"";?></a></h2>

						<!--商品分类 浮动div 开始-->
						<div class="sublist" style='display:none'>

							<div class="items">
								<strong>选择分类</strong>
								<?php if(isset($first['second'])){?>
								<?php foreach($first['second'] as $key => $second){?>
								<dl class="category selected">
									<dt>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$second[id]");?>"><?php echo isset($second['name'])?$second['name']:"";?></a>
									</dt>

									<dd>
										<?php if(isset($second['more'])){?>
										<?php foreach($second['more'] as $key => $third){?>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$third[id]");?>"><?php echo isset($third['name'])?$third['name']:"";?></a>|
										<?php }?>
										<?php }?>
									</dd>
								</dl>
								<?php }?>
								<?php }?>

							</div>

						</div>
						<!--商品分类 浮动div 结束-->

					</li>
				<?php }?>

			</ul>
			<!--总的商品分类-结束-->

		</div>

		<div class="searchbox">

			<form method='get'>
				<input type='hidden' name='controller' value='site' />
				<input type='hidden' name='action' value='search_list' />
				<?php $word = IReq::get('word');?>
				<input class="text" type="text" name='word' id="word" autocomplete="off" value="<?php echo $word ? $word : '输入关键字...';?>" />
				<input class="btn" type="submit" value="商品搜索" onclick="checkInput('word','输入关键字...');" />
			</form>

			<!--自动完成div 开始-->
			<ul class="auto_list" style='display:none'></ul>
			<!--自动完成div 开始-->

		</div>
		<div class="hotwords">热门搜索：
			<?php $query = new IQuery("keyword");$query->where = "hot = 1";$query->limit = "5";$query->order = "`order` asc";$items = $query->find(); foreach($items as $key => $item){?>
			<?php $tmpWord = urlencode($item['word']);?>
			<a href="<?php echo IUrl::creatUrl("/site/search_list/word/$tmpWord");?>"><?php echo isset($item['word'])?$item['word']:"";?></a>
			<?php }?>
		</div>
	</div>

	<div class="position">
		您当前的位置： <a href="<?php echo IUrl::creatUrl("");?>">首页</a>&nbsp;&gt;&nbsp;我的账户
	</div>
	<div class="wrapper clearfix">
		<div class="sidebar f_l">
			<img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/ucenter/ucenter.gif";?>" width="180" height="40" />
			<div class="box">
				<div class="title"><h2>交易记录</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/integral");?>">我的积分</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/redpacket");?>">我的代金券</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg2'>服务中心</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/refunds");?>">退款申请</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/complain");?>">站点建议</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/consult");?>">商品咨询</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/evaluation");?>">商品评价</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg3'>应用</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/message");?>">短信息</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/favorite");?>">收藏夹</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg4'>账户资金</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/account_log");?>">帐户余额</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/online_recharge");?>">在线充值</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg5'>个人设置</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/address");?>">地址管理</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/info");?>">个人资料</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/password");?>">修改密码</a></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="main f_r">
    <div class='tabs'>
        <div class="uc_title m_10 tabs_menu">
            <label class="current node" ><span>我的退款</span></label><label class="node" onclick="form_add()"><span>申请退款</span></label>
        </div>
        <div class="tabs_content">
            <div class='node' id="refunds_list" >
                <table class="list_table m_10" width="100%" cellpadding="0" cellspacing="0">
                    <col width="150px" />
                    <col width="150px" />
                    <col width="150px" />
                    <col width="150px" />
                    <col />
                    <thead><tr><th>退款方式</th><th>涉及订单</th><th>申请时间</th><th>处理状态</th><th>操作</th></tr></thead>
					<tbody>
					<?php $page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;?>
                    <?php $query = new IQuery("refundment_doc");$query->where = "user_id = $user[user_id]";$query->order = "id desc";$query->page = "$page";$items = $query->find(); foreach($items as $key => $item){?>
                        <tr>
                            <td><?php if($item['refundment_type']==0){?>退款至账户余额<?php }elseif($item['refundment_type']==1){?>退款至银行卡<?php }else{?>其它支付方式<?php }?></td><td><?php echo isset($item['order_no'])?$item['order_no']:"";?></td><td><?php echo isset($item['time'])?$item['time']:"";?></td><td><?php if($item['pay_status']==0){?><span class="orange bold">等待处理</span><?php }elseif($item['pay_status']==1){?><span class="gray bold">退款失败</span><?php }elseif($item['pay_status']==2){?><span class="green bold">退款成功</span><?php }?></td><td><?php if($item['pay_status']==0){?><a class="blue" href="javascript:void(0)" onclick='delModel({link:"<?php echo IUrl::creatUrl("/ucenter/refunds_del/id/$item[id]");?>"})'>取消</a>|<a class="blue" href="javascript:void(0)" onclick='form_back(<?php echo JSON::encode($item);?>)'>修改</a>|<?php }?><a class="blue" href="<?php echo IUrl::creatUrl("/ucenter/refund_detail/id/$item[id]");?>">查看</a></td>
                        </tr>
                    <?php }?>
                    </tbody>
					<tfoot><tr><td colspan="5" class="t_l"><?php echo $query->getPageBar();?></td></tr></tfoot>
                </table>
            </div>
        </div>
    </div>
    <div id="refunds_form" class="orange_box">
	    <form action="<?php echo IUrl::creatUrl("/ucenter/refunds_edit");?>" method='post' name='refunds'>
		    <input type="hidden" name="id" value="" />
		    <table  class=" form_table" width="100%" cellpadding="0" cellspacing="0">
		        <col width="120px" />
		        <col />
		        <caption>退款信息：</caption>
		        <tr>
		            <th>涉及订单号：</th><td><input type="text" name="order_no" pattern='^\d{20}$' alt='订单号不正确' class="normal" value="<?php echo IReq::get('order_no');?>" /><label>请填写上你购买的订单账号</label></td>
		        </tr>
		        <tr>
		            <th>退款类型：</th>
		            <td class="gray">
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="0" onclick='setRefundment(0)' id="RadioGroup1_0" checked="checked" />退款至账户余额（<span class="orange">推荐</span>，不会收取手续费，今后可随时将账户余额退至银行卡）</label><br />
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="1" onclick='setRefundment(1)' id="RadioGroup1_0" />退款至银行卡（跨行退款需要扣除一定积分用以支付银行手续费）</label><br />
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="2" onclick='setRefundment(2)' id="RadioGroup1_0" />其它方式:（如支付宝、快钱等等）</label>
		            </td>
		        </tr>
		        <tr id="refundment_name">
		            <th>开户行/支付方式：</th><td><input type="text" pattern="required" name="refundment_name" class="normal" /></td>
		        </tr>
		        <tr id="refundment_username">
		            <th>开户名：</th><td><input type="text" pattern="required" name="refundment_username" class="normal" /></td>
		        </tr>
		        <tr id="refundment_account">
		            <th>账号：</th><td><input type="text" pattern="required" name="refundment_account" class="normal" /></td>
		        </tr>
		        <tr>
		            <th>申请原因：</th><td><textarea name="content"></textarea></td>
		        </tr>
		        <tr>
		            <th></th><td colspan="3"><label class="btn"><input type="submit" value="提交退款申请" /></label><label class="btn"><input type="reset" value="取消" onclick="javascript:window.location.href='<?php echo IUrl::creatUrl("/ucenter/refunds");?>'" /></label></td>
		        </tr>
		    </table>
	    </form>
    </div>
</div>
<script type='text/javascript'>

	//初始化表单
	$('#refundment_name ,#refundment_name input').css('display','none');
	$('#refundment_username, #refundment_username input').css('display','none');
	$('#refundment_account, #refundment_account input').css('display','none');
	function setRefundment(type)
	{
	    if(type==0)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','none');
	        $('#refundment_username, #refundment_username input').css('display','none');
	        $('#refundment_account, #refundment_account input').css('display','none');
	    }
	    else if(type==1)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','');
	        $('#refundment_username, #refundment_username input').css('display','');
	        $('#refundment_account, #refundment_account input').css('display','');
	    }
	    else if(type==2)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','');
	        $('#refundment_username, #refundment_username input').css('display','none');
	        $('#refundment_account, #refundment_account input').css('display','');
	    }
	}
	function form_back(obj)
	{
	    $('#refunds_list').css('display','none');
	    var form = new Form('refunds');
	    form.init(obj);
	    setRefundment(obj.refundment_type);
	}
	function form_add()
	{
	    var form = new Form();
	    form.init({"order_no":"","amount":null,"time":"","refundment_type":"0","refundment_username":"","refundment_name":"","refundment_account":"","refundment_bank":"0","content":""});
	    setRefundment(0);
	}
	<?php if(isset($this->msg) && $this->msg!=''){?>alert('<?php echo isset($this->msg)?$this->msg:"";?>');var form = new Form();var obj = <?php echo isset($this->info)?$this->info:"";?>;form.init(obj);setRefundment(obj.refundment_type);<?php }?>
</script>

	</div>


	<?php echo $siteConfig->site_footer_code;?>

</div>
<script type='text/javascript'>
	//tabs的通用代码
	(function($){
		$(".tabs").each(function(i){
		    var parrent = $(this);
			$('.tabs_menu .node',this).each(function(j){
				var current=".node:eq("+j+")";
				$(this).bind('click',function(event){
					$('.tabs_menu .node',parrent).removeClass('current');
					$(this).addClass('current');
					$('.tabs_content>.node',parrent).css('display','none');
					$('.tabs_content>.node:eq('+j+')',parrent).css('display','block');
				});
			});
		});
	})(jQuery);

	//隔行换色
	$(".list_table tr::nth-child(even)").addClass('even');
	$(".list_table tr").hover(
		function () {
			$(this).addClass("sel");
		},
		function () {
			$(this).removeClass("sel");
		}
	);
    //用户中心导航条
    function menu_current()
    {
        var current = "<?php echo $this->getAction()->getId();?>";
        if(current == 'consult_old') current='consult';
        else if(current == 'isevaluation') current ='evaluation';
        else if(current == 'withdraw') current = 'account_log';
        var tmpUrl = "<?php echo IUrl::creatUrl("/ucenter/current");?>";
        tmpUrl = tmpUrl.replace("current",current);
        $('div.cont ul.list li a:[href^="'+tmpUrl+'"]').parent().addClass("current");
    }
    menu_current();
</script>
<script type='text/javascript' src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/site.js";?>'></script>
<script type='text/javascript'>
var url_head = 	encodeURIComponent('<?php echo isset($iurl)?$iurl:"";?>');
	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete(decodeURIComponent(url_head)+'index.php'+decodeURIComponent('%2F')+'site'+decodeURIComponent('%2F')+'autoComplete','<?php echo IUrl::creatUrl("/site/search_list");?>','<?php echo isset($site_config['auto_finish'])?$site_config['auto_finish']:"";?>');}
	});

	//购物车div层
	$('.mycart').hover(
		function(){
			showCart('<?php echo IUrl::creatUrl("/simple/showCart");?>');
		},
		function(){
			$('#div_mycart').hide('slow');
		}
	);
</script>
</body>
</html>
